#ifndef CREATCHARTS_H
#define CREATCHARTS_H

// #include "qchart.h"
#include <QtCharts/QChartView>
#include <QtCharts/QPieSeries>
#include <QtCharts/QPieSlice>
#include <QtCharts/QAbstractBarSeries>
#include <QtCharts/QPercentBarSeries>
#include <QtCharts/QStackedBarSeries>
#include <QtCharts/QBarSeries>
#include <QtCharts/QBarSet>
#include <QtCharts/QLineSeries>
#include <QtCharts/QSplineSeries>
#include <QtCharts/QScatterSeries>
#include <QtCharts/QAreaSeries>
#include <QtCharts/QLegend>
#include <QtCharts/QBarCategoryAxis>
#include <QtCharts/QValueAxis>
#include <QtCharts/QChartGlobal>
//#include "customslice.h"
//QT_CHARTS_BEGIN_NAMESPACE
//class QChartView;
//class QChart;
//QT_CHARTS_END_NAMESPACE

#ifdef X86
#elif defined ARM
QT_CHARTS_USE_NAMESPACE
#endif
class CreatCharts
{
public:
    CreatCharts();
    ~CreatCharts();
    QChart *createLineChart_HR();
    void update_HRData(double hr);

    QChart *createLineChart_OX();
    void update_OXData( double ox);

    QChart *createLineChart_MP();
    void update_MPData(double mp);

    QChart *createPieChart_MP();
    void update_MP_PieData(QList<double>mp);

    QChart *createPieChart_PSD();
    void update_PSD_PieData(double vlf,double lf,double hf);

    QChart *createPieChart_a_hr();
    QChart *createPieChart_a_ox();
    QChart *createPieChart_a_mp();
    QChart *createPieChart_a_fatigure();
    QChart *createPieChart_a_depress();
    QChart *createPieChart_a_ansiety();
    QChart *createPieChart_a_ballance();
    QChart *createPieChart_a_activity();

    void update_A_PieData(int type,QList<int>v);

    QChart *createHRVHistBarChart();
    void update_HRVHistBarData(QList<int> RR,int rr_len);

    QChart *createAreaChart();//用于创建AR功率谱图
    void update_HRVAreaData(QList<double> freq,QList<double> psd);

    QChart *creatScatterchart();
    void update_HRVScatterData(QList<int> RR,int RR_Len);

    QChart *DrawHRV_BallanceBarChart();
    void update_BallanceData(int SNE);
    QChart *createABCDHistBarChart();
    void update_ABCDHistBarData(double data_a,double data_b,double data_c,double data_d);

    QChart *createLineChart_Battle_Lines();
    void update_LineChart_Battle_LinesData(double data_a,double data_b,double data_c,double data_d);

private:
    QLineSeries *series_HR,*series_Ox,*series_Mp;
    int Axes_HR_Len=20;
    int Axes_OX_Len=20;
    int Axes_MP_Len=20;
    QPieSeries *Pieseries_MP,*PieSeries_PSD;
    QPieSlice *slice_MP;
    QList<QPieSlice*>slices_mp;
    QList<QPieSlice*>slices_psd;

    //平均模式下的图QPieSlice
    QList<QPieSlice*>slices_A_HR;
    QList<QPieSlice*>slices_A_OX;
    QList<QPieSlice*>slices_A_MP;
    QList<QPieSlice*>slices_A_FATIGURE;
    QList<QPieSlice*>slices_A_DEPRESS;
    QList<QPieSlice*>slices_A_ANSIETY;
    QList<QPieSlice*>slices_A_BALLANCE;
    QList<QPieSlice*>slices_A_ACTIVITY;

    QBarSet *HRVHist_BarSet ;

    QAreaSeries *area_VLF,*area_LF,*area_HF;
    QLineSeries *lowerSeries_vlf,*upperSeries_vlf;
    QLineSeries *lowerSeries_lf,*upperSeries_lf;
    QLineSeries *lowerSeries_hf,*upperSeries_hf;

    QScatterSeries *HRV_Scatterseries;
    QBarSet *HRV_BallanceBarSet;


    QLineSeries *series_A,*series_B,*series_C,*series_D;

    QBarSet *AHist_BarSet ,*BHist_BarSet ,*CHist_BarSet ,*DHist_BarSet ;
    QColor *pc_good,*pc_normal,*pc_bad;//饼图的三个颜色

};

#endif // CREATCHARTS_H
